package com.dfkj.file.controller;

import com.dfkj.file.common.BaseResponse;
import com.dfkj.file.common.ResultUtils;
import com.dfkj.file.model.dto.post.DownLoadDto;
import com.dfkj.file.service.DownLoadService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
@Api(tags = "图片检索")
@RestController
@RequestMapping("/file")
public class FileController {

    @Resource
    DownLoadService downLoadService;

    @ApiOperation("根据传入链接下载文件")
    @PostMapping("/download")
    public BaseResponse download(@RequestBody DownLoadDto dto) {

        downLoadService.DownLoadFile(dto);

        return ResultUtils.success("已创建任务，稍后在任务列表进行下载");

    }

}
